/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.amuthu.expression.function.indicator;

import org.amuthu.DataStore;
import org.amuthu.expression.Expression;
import org.amuthu.indicator.OnBalanceVolume;
import org.amuthu.parser.ExpressionVisitor;

/**
 * obv(startOffset)
 * @author prabhu
 */
public class ObvFunction extends OffsetFunction
{
   public ObvFunction()
   {
   }

   @Override
   public double calculateIndicator(DataStore dataStore, Expression[] arguments, ExpressionVisitor visitor)
   {
      OnBalanceVolume obv = new OnBalanceVolume(dataStore, getOffset());

      return obv.calculate();
   }

   @Override
   public int calculateDependency(DataStore dataStore, Expression[] arguments, ExpressionVisitor visitor)
   {
      OnBalanceVolume obv = new OnBalanceVolume(dataStore, getOffset());

      return obv.getDayDependency();
   }

}
